package cn.com.lms.business.exam.persistence.entity;

import com.bnzj.core.json.DateDeserializer;
import com.bnzj.core.util.FbConstant;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

@Entity
@Getter
@Setter
@Table(name = "bnz_exam_employee_paper")
@Schema(description = "用户答卷表")
public class EmployeePaper {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Schema(description = "唯一标识")
    protected Long id;// 主键

    @Schema(name = "试卷ID")
    @Column(name = "paper_id")
    private Long paperId;


    @Schema(name = "通过分数")
    @Column(name = "adopt_score")
    private Integer adoptScore;

    @Schema(name = "限考次数")
    @Column(name = "limit_num")
    private Integer limitNum;

    @Schema(name = "答卷类型 1-测验 2-考试")
    private Short type;


    @Schema(name = "用户ID")
    @Column(name = "employee_id")
    private Long employeeId;

    @Schema(name = "剩余答题时间,单位秒")
    @Column(name = "remain_time")
    private Integer remainTime;

    @Schema(name = "成绩")
    private Integer grade;

    @Schema(name = "是否交卷 0-未交卷  1 已交卷")
    @Column(name = "is_hand")
    private Boolean isHand;

    @Column(name = "create_time")
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = FbConstant.DATETIME_FORMAT)
    @JsonDeserialize(using = DateDeserializer.class)
    @JsonFormat(pattern = FbConstant.DATETIME_FORMAT, timezone = "GMT+8")
    @Schema(description = "创建时间")
    private Date createTime;// 创建时间

    @Column(name = "modify_time")
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = FbConstant.DATETIME_FORMAT)
    @JsonDeserialize(using = DateDeserializer.class)
    @JsonFormat(pattern = FbConstant.DATETIME_FORMAT, timezone = "GMT+8")
    @Schema(description = "修改时间")
    private Date modifyTime;// 修改时间



}
